/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-06-15
 * Time: 18:36
 */
class Myarray2<T>{
    public T[] myarray = (T[])new Object[10];
    //public T[] myarray = new T[10];
    public void setVal(int pos,T val){
        myarray[pos] = val;
    }
    public T getVal(int pos){
        return myarray[pos];
    }
    public T[] getArray(){
        return myarray;
    }
//    public static T findMaxVal(T[] nums){
//
//    }
}
class Alg<T>{

    public static<T extends Comparable<T>> T findMaxVal(T[] nums){
        T max = nums[0];
        for (int i = 0; i < nums.length; i++) {
            if(max.compareTo(nums[i]) < 0){
                max = nums[i];
            }
        }
        return max;
    }
}
class Myarray{
    public Object[] myarray = new Object[10];

    public void setVal(int pos,Object val){
        myarray[pos] = val;
    }
    public Object getVal(int pos){
        return myarray[pos];
    }
}
public class TestDemo1{
    public static void main(String[] args) {
        Myarray2<Integer> myarray2 = new Myarray2<>();
        myarray2.setVal(0,10);
        myarray2.setVal(1,20);
        Integer tmp = myarray2.getVal(0);
        System.out.println(tmp);
        System.out.println("==================");
        Myarray2<String> myarray21 = new Myarray2<>();
        myarray21.setVal(0,"hello");
        String str = myarray21.getVal(0);
        System.out.println(str);
    }
    public static void main1(String[] args){
        Myarray myarray = new Myarray();
        myarray.setVal(0,1);
        myarray.setVal(1,"hello");
        String s = (String)myarray.getVal(1);
        System.out.println(s);
    }
}